package com.education.api;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;


/**
 * 管理后台启动类
 * @author zengjintao
 * @version 1.0
 * @create_at 2020/3/8 11:11
 */
@SpringBootApplication(scanBasePackages =
   {
       "com.education"
   }

)
@MapperScan("com.education.business.mapper")
@EnableCaching
public class EducationApiApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext context = SpringApplication.run(EducationApiApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        String port = environment.getProperty("server.port");
        String ip = InetAddress.getLocalHost().getHostAddress();
        System.out.println("启动完成，系统访问地址：http://localhost:" + port);
        System.out.println("启动完成，系统访问局域网地址：http://"+ip+":"+port);
    }
}
